package com.witte.serviceImp;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.witte.dao.ChanceMapper;
import com.witte.dao.UserMapper;
import com.witte.entity.Chance;
import com.witte.service.ChanceService;
import com.witte.service.UserService;

@Service
public class ChanceServiceImp implements ChanceService{

	
	@Autowired(required=false)
	ChanceMapper chanceMapper;
	
	
	@Override
	public List<Chance> selectAll(){
		List<Chance> chances = chanceMapper.selectAll();
		return chances;
	}
	
	@Override
	public List<Chance> selectKey(String key){
		List<Chance> chances = chanceMapper.selectKey();
		return chances;
	}
	
	@Override
	public int updateByChanceNo(Chance chance){
		int a= chanceMapper.updateByPrimaryKey(chance);
		return a;
	}
	
	@Override
	public int deleteByPrimaryKey(Integer chanceno){
		int a= chanceMapper.deleteByPrimaryKey(chanceno);
		return a;
	}
	
	@Override
	public int insertSelective(Chance chance){
		int a= chanceMapper.insertSelective(chance);
		return a;
	}
	
	@Override
	public int chancebelong(Chance chance) {
		chance.setState("已分派");
		return chanceMapper.updateByPrimaryKeySelective(chance);
	}
	
	@Override
	public int getRecodeCount() {
		return chanceMapper.getRecodeCount();
	}
	
	@Override
	public List<com.witte.entity.Service> getStateList(Integer beginPage,Integer pageSize) {
		int begain= (beginPage-1)*pageSize;
		return chanceMapper.selectByState(begain,pageSize);
	}

	
}
